import qlib
from qlib.data import D

from common.config import CN_DATA_TEST, CN_DATA


def query_symbol_test(symbol, path=CN_DATA_TEST):
    qlib.init(provider_uri=str(path.resolve()))

    cal = D.calendar(start_time='2010-01-01', end_time='2017-12-31', freq='day')
    print(cal)
    data = D.features([symbol], ['$close', '$factor', 'P($$roe_q)', 'P($$eps_q)'], start_time='2022-01-01', freq='day')
    print(data)


if __name__ == '__main__':
    query_symbol_test('600519.SH')
    # query_symbol_test('sh600519', path=CN_DATA.resolve())
